/*
    Submission - model class
*/
package com.semanticbits.codejam.model

import ariba.appcore.*
import ariba.ui.meta.annotations.*
import ariba.ui.meta.annotations.Property.*
import ariba.ui.meta.persistence.*
import ariba.appcore.annotations.*
import org.compass.annotations.*

import javax.persistence.*
import java.util.*
import ariba.ui.meta.annotations.Trait.Required

@Entity @NavModuleClass @Searchable(root=false)
@DefaultAccess @AnonymousAccess([Permission.ClassOperation.view])
class Submission
{
    @Id @GeneratedValue
    private Long id

    @Required @SearchableProperty @Trait.LabelField
    String name

    @Required @ManyToOne Contest contest

    @ManyToOne User submitter = User.currentUser();

    @Required
    Date submissionDate = new Date();

    @Required @SearchableProperty @Trait.RichText
    String solutionDescription

    @Required
    String subversionURL

    @Required
    String hudsonURL

    int finalPoints = 0
    boolean winner = false

    @SearchableProperty @Trait.RichText
    String winningReason


    boolean reject = false

    //@SearchableProperty @Trait.RichText
    //String rejectionReason

    String award = 0

    @OneToMany @SearchableComponent
    List <JudgeNotes> notes = new ArrayList<JudgeNotes>()

}
